package com.aprivate.leo.commonlib.utils;

import android.util.Log;

/**
 * Author: Administrator
 * Date: 2020/2/10
 * Project: ModularizationTemplateApp
 * Description:
 */
public class LogUtils {
    private static LogUtils INSTANCE;

    private LogUtils() {
    }

    public static LogUtils getInstance() {
        if (INSTANCE == null) {
            synchronized (LogUtils.class) {
                if (INSTANCE == null) {
                    INSTANCE = new LogUtils();

                }
            }
        }
        return INSTANCE;
    }

    public void showLog(String msg){
        StackTraceElement[] stackTrace = new Throwable().getStackTrace();
        StackTraceElement element = stackTrace[1];
        if(element!=null){
            StringBuilder sb = new StringBuilder();
            sb.append(element.getClassName())
                    .append("->")
                    .append(element.getLineNumber())
                    .append("->")
                    .append(element.getMethodName())
                    .append(":")
                    .append(msg);
            Log.e("APP_LOG", msg);
        }
    }

}
